<?php

namespace app\admin\model;

use think\Db;

/**
 * 统计数据模型 - 虚拟模型
 *
 * @author leolei <346991581@qq.com>
 */
class Total
{
    /**
     * 文章统计
     *
     * @return void
     * @author leolei <346991581@qq.com>
     */
    public function article()
    {
        $where['is_deleted'] = 0;
        $where['type'] = 0;
        $return['total'] = Db::name('YogaArticle')->where($where)->count();//总数
        $where['create_time'] = ['gt',strtotime('today')];
        $return['today'] = Db::name('YogaArticle')->where($where)->count();//今日数
        return $return;
    }

    /**
     * 单页文章
     *
     * @return void
     * @author leolei <346991581@qq.com>
     */
    public function page()
    {
        $where['is_deleted'] = 0;
        $where['type'] = 1;
        $return['total'] = Db::name('YogaCategory')->where($where)->count();//总数
        return $return;
    }

    /**
     * 授权统计
     *
     * @return void
     * @author leolei <346991581@qq.com>
     */
    public function auth()
    {
        $where['is_deleted'] = 0;
        $return['total'] = Db::name('YogaAuth')->where($where)->count();//总数量
        $where['type'] = 0;
        $return['person'] = Db::name('YogaAuth')->where($where)->count();//个人
        $where['type'] = 1;
        $return['company'] = Db::name('YogaAuth')->where($where)->count();//单位
        return $return;
    }
    
}